/**
 * @desc 分页器组件
 * @props {pageNumber} 当前页数
 * @props {pageSize}   当前数量
 * @props {total}      当前总数
 */
import React, {Component} from 'react'
import {Pagination} from 'antd';
import PropTypes from 'prop-types'

class ThePagination extends Component {
    render() {
        const {pageNo, pageSize, total, pageChange, showTotal, pageSizeOptions} = this.props;
        return <div className={'p-layout-pagination'}
                    style={{display: 'flex', justifyContent: 'center', padding: '20px 0', zIndex:"9"}}>
            <Pagination
                showQuickJumper
                current={pageNo}
                pageSize={pageSize}
                total={total ? total : 1}
                onChange={pageChange}
                showTotal={showTotal}
                pageSizeOptions={pageSizeOptions ?? [10, 20, 50, 100]}
            />
        </div>
    }
}

ThePagination.propTypes = {
    pageNo: PropTypes.number,
    pageSize: PropTypes.number,
    total: PropTypes.number || PropTypes.string
}
ThePagination.defaultProps = {
    pageSize: 10,
    pageNo: 1,
    total: 1
}
export default ThePagination
